package com.demo.modalframe4.utils;

import java.awt.*;

public class GraphicsUtil {

    private static Integer sw;
    private static Integer sh;

    public final static Integer Frame_Width = 300;
    public final static Integer Frame_Height = 200;

    public static int getSw() {
        if (sw == null) {
            GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
            GraphicsDevice gd = ge.getDefaultScreenDevice();
            GraphicsConfiguration gc = gd.getDefaultConfiguration();
            Insets ins = Toolkit.getDefaultToolkit().getScreenInsets(gc);
            sw = gc.getBounds().width - ins.left - ins.right;
        }
        return sw;
    }

    public static int getSh() {
        if (sh == null) {
            GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
            GraphicsDevice gd = ge.getDefaultScreenDevice();
            GraphicsConfiguration gc = gd.getDefaultConfiguration();
            Insets ins = Toolkit.getDefaultToolkit().getScreenInsets(gc);
            sh = gc.getBounds().height - ins.top - ins.bottom;
        }
        return sh;
    }
}
